<?php
/**
 * Created by PhpStorm.
 * User: ASUS
 * Date: 2021/12/12
 * Time: 16:58
 */

include_once 'DBtools.php';
//连接数据库
$conn = new mysqli();
$conn ->connect('localhost','root','123456','bank');

if (!empty($conn -> connect_error)){
    echo 'MYSQL数据库连接错误:'.$conn -> connect_error;
    die;
}
echo '数据库连接成功！<br>';

DBtools::setconn($conn);
//$data = DBtools::select('select * from accountinfo');
$data = DBtools::select('select RealName from accountinfo where Accountid = 2');
print_r($data);
echo '<br/>';
echo '<br/>';
//查
$result = $conn->query('select * from accountinfo');
while(true) {
    $data = $result->fetch_assoc();
    if (empty($data)) {
        break;
    }
    print_r($data);
}
echo '<br/>';
echo '<br/>';
$result = $conn->query('select * from bankcard');
while(true) {
    $data = $result->fetch_assoc();
    if (empty($data)) {
        break;
    }
    print_r($data);
}
echo '<br/>';
echo '<br/>';
$result = $conn->query('select * from cardexchange');
while(true) {
    $data = $result->fetch_assoc();
    if (empty($data)) {
        break;
    }
    print_r($data);
}
echo '<br/>';
echo '<br/>';
$result = $conn->query('select * from cardtransfer');
while(true) {
    $data = $result->fetch_assoc();
    if (empty($data)) {
        break;
    }
    print_r($data);
}